﻿function ChangeComment(tag, PageAndParameter) {
    var getWhoRate = "SalerRate";
    var getRate = "0";
    var getComment = "-1";
    var Pageindex=1;

    var ColumnTag = "CreditStatus";
    
    if (request("RateType") != null) {
        getRate = request("RateType");
    }
    if (request("CommentRate") != null) {
        getComment = request("CommentRate");
    }
    
    

    switch (tag) {
        case "BuyC":
            getWhoRate = "BuyerRate";
            break;
        case "SalerC":
            getWhoRate = "SalerRate";
            break;
        case "OtherC":
            getWhoRate = "OtherRate";
            break;
    }

    if (request("ColumnTag") != null) {
        ColumnTag = request("ColumnTag");

    }
    
    if(request("Pageindex")!=null && request("Pageindex")!='')
    {
        Pageindex=request("Pageindex");
    }

   location.href = "" + PageAndParameter + "ColumnTag=" + ColumnTag + "&WhoRate=" + getWhoRate + "&RateType=" + getRate + "&CommentRate=" + getComment +"&Pageindex="+Pageindex;
}

function request(paras) {
    var url = location.href;
    var paraString = url.substring(url.indexOf("?") + 1, url.length).split("&");
    var paraObj = {}
    for (i = 0; j = paraString[i]; i++) {
        paraObj[j.substring(0, j.indexOf("=")).toLowerCase()] = j.substring(j.indexOf("=") + 1, j.length);
    }
    var returnValue = paraObj[paras.toLowerCase()];
    if (typeof (returnValue) == "undefined") {
        return "";
    } else {
        return returnValue;
    }
}

function ChangeRate(Value, PageAndParameter) {
    var ColumnTag = "CreditStatus";
    var getWhoRate = "SalerRate";
    var getRate = "0";
    var getComment = "-1";
    var Pageindex = 1;
    var PageCount=1;
    if (request("WhoRate") != null) {
        getWhoRate = request("WhoRate");
    }
    if (request("CommentRate") != null) {
        getComment = request("CommentRate");
    }
    if (request("ColumnTag") != null) {
        ColumnTag = request("ColumnTag");

    }
    if (request("Pageindex") != null && request("Pageindex") != '') {
        Pageindex = request("Pageindex");
    }

   getPageCount = document.getElementById("PageCountID");//获取总页数

    try {
        PageCount = parseInt(getPageCount.value);
    }
    catch (Error) {
        PageCount = 1;
    }

    if (Pageindex > PageCount && PageCount > 0) {
        Pageindex = PageCount;
    }
    
    getRate = Value;
    window.location.href = "" + PageAndParameter + "ColumnTag=" + ColumnTag + "&WhoRate=" + getWhoRate + "&RateType=" + getRate + "&CommentRate=" + getComment +"&Pageindex="+Pageindex;
}


function ChangeCommentValue(Value, PageAndParameter) {
    var ColumnTag = "CreditStatus";
    var getWhoRate = "SalerRate";
    var getRate = "0";
    var getComment = "-1";
    var Pageindex = 1;
    var PageCount = 1;//总页数
    if (request("WhoRate") != null) {
        getWhoRate = request("WhoRate");
    }
    if (request("RateType") != null) {
        getRate = request("RateType");
    }

    if (request("ColumnTag") != null) {
        ColumnTag = request("ColumnTag");

    }

    if (request("Pageindex") != null && request("Pageindex") != '') {
        Pageindex = request("Pageindex");
    }

    var getPageCount = document.getElementById("PageCountID");//获取总页数
    
    try {
        PageCount = parseInt(getPageCount.value);
    }
    catch (Error) {
        PageCount = 1;
    }

    if (Pageindex > PageCount && PageCount>0) {
        Pageindex = PageCount;
    }
    getComment = Value;
    window.location.href = "" + PageAndParameter + "ColumnTag="+ ColumnTag +"&WhoRate=" + getWhoRate + "&RateType=" + getRate + "&CommentRate=" + getComment +"&Pageindex="+Pageindex;
}

function UrlGoPage(Shop,tag,PageCount) {

    var getGoPageValue = document.getElementById(tag);
    var getPageCount = document.getElementById(PageCount);
    var PageGoNum = 1;
    var PageCount = 1;
    try
    {
        PageGoNum=parseInt(getGoPageValue.value);
    }
    catch(Error)
    {
       PageGoNum=1;
   }
   if (PageGoNum <= 0) {
       alert('你输入的数字必须为1到100');
       return false;
   }

   try {
       PageCount = parseInt(getPageCount.value);
   }
   catch (Error) {
       PageCount = 1;
   }
   if (PageGoNum > PageCount && PageCount > 0) {
       
       PageGoNum = PageCount;
   }
   
    var ColumnTag = "CreditStatus";
    var getWhoRate = "SalerRate";
    var getRate = "0";
    var getComment = "-1";
    var Pageindex = 1;
    if (request("WhoRate") != null) {
        getWhoRate = request("WhoRate");
    }
    if (request("RateType") != null) {
        getRate = request("RateType");
    }

    if (request("CommentRate") != null && request("CommentRate")!='') {
        getComment = request("CommentRate");
    }

    if (request("ColumnTag") != null) {
        ColumnTag = request("ColumnTag");

    }
    Pageindex = PageGoNum;
   
    window.location.href = "?"+ Shop +"ColumnTag=" + ColumnTag + "&WhoRate=" + getWhoRate + "&RateType=" + getRate + "&CommentRate=" + getComment + "&Pageindex=" + Pageindex;

}